package com.hongyuan.sellfitness.ui.person.beans;

import android.view.View;

import com.hongyuan.sellfitness.R;
import com.hongyuan.sellfitness.utils.TimeUtil;

import java.util.List;

public class MyGroupBean {

    private List<ListBean> list;

    public List<ListBean> getList() {
        return list;
    }

    public void setList(List<ListBean> list) {
        this.list = list;
    }

    public static class ListBean {
        /**
         * ocs_id : 2
         * m_id : 3
         * os_id : 12
         * add_time : 1563852761
         * ocs_state : 1
         * cs_id : 2
         * xy_qd_time : 0
         * xy_qd_state : 0
         * xy_qt_time : 0
         * xy_qt_state : 0
         * os_name : 首玺健身(旗舰店)
         * cs_start_time : 1565769600
         * cs_end_time : 1565773200
         * cs_name : 瑜伽团课
         * si_name : 瑜伽
         * cs_state : 1
         * cs_max_num : 40
         * cs_min_num : 23
         * cs_img : http://hongyuangood.oss-cn-hangzhou.aliyuncs.com/uplaod/image/20190723/4b41caee65c601d24059a81152563b909ceff164_800x600.jpg
         * state_name : 报名中
         * to_state : 1
         * add_date : 2019-07-23 11:32:41
         * cs_start_date : 2019-08-14 16:00:00
         * cs_end_date : 2019-08-14 17:00:00
         */

        private int ocs_id;
        private int m_id;
        private int os_id;
        private int add_time;
        private int ocs_state;
        private int cs_id;
        private int xy_qd_time;
        private int xy_qd_state;
        private int xy_qt_time;
        private int xy_qt_state;
        private String os_name;
        private long cs_start_time;
        private long cs_end_time;
        private String cs_name;
        private String si_name;
        private int cs_state;
        private int cs_max_num;
        private int cs_min_num;
        private String cs_img;
        private String state_name;
        private String to_state;
        private String add_date;
        private String cs_start_date;
        private String cs_end_date;
        private long now_time;

        public long getNow_time() {
            return now_time;
        }

        public void setNow_time(long now_time) {
            this.now_time = now_time;
        }

        public int getOcs_id() {
            return ocs_id;
        }

        public void setOcs_id(int ocs_id) {
            this.ocs_id = ocs_id;
        }

        public int getM_id() {
            return m_id;
        }

        public void setM_id(int m_id) {
            this.m_id = m_id;
        }

        public int getOs_id() {
            return os_id;
        }

        public void setOs_id(int os_id) {
            this.os_id = os_id;
        }

        public int getAdd_time() {
            return add_time;
        }

        public void setAdd_time(int add_time) {
            this.add_time = add_time;
        }

        public int getOcs_state() {
            return ocs_state;
        }

        public void setOcs_state(int ocs_state) {
            this.ocs_state = ocs_state;
        }

        public int getCs_id() {
            return cs_id;
        }

        public void setCs_id(int cs_id) {
            this.cs_id = cs_id;
        }

        public int getXy_qd_time() {
            return xy_qd_time;
        }

        public void setXy_qd_time(int xy_qd_time) {
            this.xy_qd_time = xy_qd_time;
        }

        public int getXy_qd_state() {
            return xy_qd_state;
        }

        public void setXy_qd_state(int xy_qd_state) {
            this.xy_qd_state = xy_qd_state;
        }

        public int getXy_qt_time() {
            return xy_qt_time;
        }

        public void setXy_qt_time(int xy_qt_time) {
            this.xy_qt_time = xy_qt_time;
        }

        public int getXy_qt_state() {
            return xy_qt_state;
        }

        public void setXy_qt_state(int xy_qt_state) {
            this.xy_qt_state = xy_qt_state;
        }

        public String getOs_name() {
            return os_name;
        }

        public String getShowOs_name() {
            return os_name+"/"+si_name;
        }

        public void setOs_name(String os_name) {
            this.os_name = os_name;
        }

        public long getCs_start_time() {
            return cs_start_time;
        }

        public void setCs_start_time(long cs_start_time) {
            this.cs_start_time = cs_start_time;
        }

        public long getCs_end_time() {
            return cs_end_time;
        }

        public void setCs_end_time(long cs_end_time) {
            this.cs_end_time = cs_end_time;
        }

        public String getCs_name() {
            return cs_name;
        }

        public void setCs_name(String cs_name) {
            this.cs_name = cs_name;
        }

        public String getSi_name() {
            return si_name;
        }

        public void setSi_name(String si_name) {
            this.si_name = si_name;
        }

        public int getCs_state() {
            return cs_state;
        }

        public void setCs_state(int cs_state) {
            this.cs_state = cs_state;
        }

        public int getCs_max_num() {
            return cs_max_num;
        }

        public void setCs_max_num(int cs_max_num) {
            this.cs_max_num = cs_max_num;
        }

        public int getCs_min_num() {
            return cs_min_num;
        }

        public void setCs_min_num(int cs_min_num) {
            this.cs_min_num = cs_min_num;
        }

        public String getCs_img() {
            return cs_img;
        }

        public void setCs_img(String cs_img) {
            this.cs_img = cs_img;
        }

        public String getState_name() {
            return state_name;
        }

        public void setState_name(String state_name) {
            this.state_name = state_name;
        }

        public String getTo_state() {
            return to_state;
        }

        public void setTo_state(String to_state) {
            this.to_state = to_state;
        }

        public String getAdd_date() {
            return add_date;
        }

        public void setAdd_date(String add_date) {
            this.add_date = add_date;
        }

        public String getCs_start_date() {
            return cs_start_date;
        }

        public void setCs_start_date(String cs_start_date) {
            this.cs_start_date = cs_start_date;
        }

        public String getCs_end_date() {
            return cs_end_date;
        }

        public void setCs_end_date(String cs_end_date) {
            this.cs_end_date = cs_end_date;
        }

        public String getMeAdd_date() {
            return TimeUtil.formatDate(add_date,TimeUtil.dateFormatYMDHMS,TimeUtil.dateFormatDotYMD);
        }

        /*
         * 获取显示时间
         * */
        public String showTimeText(){
            String showTime = TimeUtil.formatDate(cs_start_date,TimeUtil.dateFormat,TimeUtil.dateFormatMDofChinese);
            showTime+=" "+TimeUtil.formatDate(cs_start_date,TimeUtil.dateFormat,TimeUtil.dateFormatHM);
            showTime+="-"+TimeUtil.formatDate(cs_end_date,TimeUtil.dateFormat,TimeUtil.dateFormatHM);
            return showTime;
        }

        /*
        * 签到按钮显示文字内容
        * */
        public String showQdText(){
            if(xy_qd_state == 1){
                return "已签到";
            }else{
                //int time = TimeUtil.getOffectMinutes(item.getCs_start_date(),TimeUtil.dateFormatYMDHMS);
                //距离课程开始相差的分钟数
                int differenceStart = TimeUtil.getOffectMinutes(cs_start_time*1000,now_time*1000);
                //距离课程结束相差的分钟数
                int differenceEnd = TimeUtil.getOffectMinutes(cs_end_time*1000,now_time*1000);

                if(differenceStart > 30){
                    return "取消报名";
                }else if(differenceStart <= 30 && differenceEnd >= -30){
                    return "扫码签到";
                }else{
                    return "未签到";
                }
            }
        }

        /*
        * 签到显示的字体颜色
        * */
        public boolean isRedColor(){
            if(xy_qd_state == 1){
                return false;
            }else{
                //int time = TimeUtil.getOffectMinutes(item.getCs_start_date(),TimeUtil.dateFormatYMDHMS);
                //距离课程开始相差的分钟数
                int differenceStart = TimeUtil.getOffectMinutes(cs_start_time*1000,now_time*1000);
                //距离课程结束相差的分钟数
                int differenceEnd = TimeUtil.getOffectMinutes(cs_end_time*1000,now_time*1000);

                if(differenceStart > 30){
                    return true;
                }else if(differenceStart <= 30 && differenceEnd >= -30){
                    return false;
                }else{
                    return false;
                }
            }
        }

        /*
         * 操作类型
         * 0不可操作
         * 1签到
         * 2取消报名
         * */
        public int getOperateType(){
            if(xy_qd_state == 1){
                return 0;
            }else{
                //int time = TimeUtil.getOffectMinutes(item.getCs_start_date(),TimeUtil.dateFormatYMDHMS);
                //距离课程开始相差的分钟数
                int differenceStart = TimeUtil.getOffectMinutes(cs_start_time*1000,now_time*1000);
                //距离课程结束相差的分钟数
                int differenceEnd = TimeUtil.getOffectMinutes(cs_end_time*1000,now_time*1000);

                if(differenceStart > 30){
                    return 2;
                }else if(differenceStart <= 30 && differenceEnd >= -30){
                    return 1;
                }else{
                    return 0;
                }
            }
        }

        /*
        * 设置签到显示的背景样式
        * */
        public int showQdBg(){
            if(xy_qd_state == 1){
                return R.drawable.shape_radius24_cccccc;
            }else{
                //int time = TimeUtil.getOffectMinutes(item.getCs_start_date(),TimeUtil.dateFormatYMDHMS);
                //距离课程开始相差的分钟数
                int differenceStart = TimeUtil.getOffectMinutes(cs_start_time*1000,now_time*1000);
                //距离课程结束相差的分钟数
                int differenceEnd = TimeUtil.getOffectMinutes(cs_end_time*1000,now_time*1000);

                if(differenceStart > 30){
                    return R.drawable.shape_radius24_0000000_stroke_ef5b48;
                }else if(differenceStart <= 30 && differenceEnd >= -30){
                    return R.drawable.shape_radius24_ef5b48;
                }else{
                    return R.drawable.shape_radius24_cccccc;
                }
            }
        }

        /*
        * 描述显示文字内容
        * */
        public String showDesText(){
            if(xy_qd_state == 1){
                return "";
            }else{
                //int time = TimeUtil.getOffectMinutes(item.getCs_start_date(),TimeUtil.dateFormatYMDHMS);
                //距离课程开始相差的分钟数
                int differenceStart = TimeUtil.getOffectMinutes(cs_start_time*1000,now_time*1000);
                //距离课程结束相差的分钟数
                int differenceEnd = TimeUtil.getOffectMinutes(cs_end_time*1000,now_time*1000);

                if(differenceStart > 30){
                    return "未到签到时间";
                }else if(differenceStart <= 30 && differenceEnd >= 0){
                    if(differenceStart <= 30 && differenceStart > 0){
                        return "距离开课还有"+differenceStart+"分钟";
                    }else{
                        return "课程已开始";
                    }
                }else{
                    return "";
                }
            }
        }
    }
}
